<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:fb="http://www.facebook.com/2008/fbml" xml:lang="en">
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <title><?php echo $view->contest['name']; ?></title>
        <style type="text/css">
            body {
                margin:0px;
                padding:0px;
                font-family:Arial, Helvetica, sans-serif;
                font-size:12px;
                color:#000;
            }
            p {
                line-height:16px;
                margin:0px;
                padding:0px;
            }

            h1 {
                padding:0px;
                margin-bottom:5px;
                margin-top:0px;
                font-size:14px;
            }
            a {
                color:#000;
                text-decoration:none;
            }
            a:hover {
                color:#000;
                text-decoration:underline;
            }

            img{ border:0px; background:none;}
            img a{ border:0px; background:none;}
            .w760{ width:760px;}
            .mc{ margin:0 auto;}
            .bg_top{ 
                background: url("layouts/images/top_bg.jpg") repeat-y scroll left top transparent;
                padding: 1px 0 1px 12px;
                width: 748px;
            }
            .logo{ width:155px; height:91px;}
            .img_top{ width:737px; height:auto;}
            ul.menu{ list-style:none; padding-left:24px; margin-left:0px; height:37px; background:#c4ced8; padding-top:15px; margin-top:0px; margin-bottom:0px;}
            ul.menu li{padding-left:0px; margin-left:0px; float:left; margin-right:2px; padding-right:0px;}
            ul.menu li a{ display:block; padding:10px 20px 10px 20px; color:#486584; border:1px solid #c4cfdb;border-bottom:1px solid #c3cdd9;}
            ul.menu li a:hover{ color:#000; border-top:1px solid #9baec2;border-bottom:1px solid #fff;border-right:1px solid #9baec2;border-left:1px solid #9baec2; background-color:#fff; text-decoration:none;}
            ul.menu li a.curr{ color:#000; border-top:1px solid #9baec2;border-bottom:1px solid #fff;border-right:1px solid #9baec2;border-left:1px solid #9baec2; background-color:#fff; text-decoration:none;}
            .bg_mid{ background:url(layouts/images/bg_mid.jpg) top left repeat-y; padding-bottom:20px;}
            .bg_bottom{ background:url(layouts/images/bot_bg.jpg) top left no-repeat; height:27px; width:715px; padding:5px 0px 0px 45px;}
            .w730{ width:730px;}
            .w170{ width:162px; border:1px solid #000; margin-left:10px; padding:3px 3px 3px 3px; height:120px; float:left;}
            .w170 img{ width:162px;}
            .p20t{ padding-top:20px;}
            .po{ position:relative;}
            .black_bg1{ text-align:center; padding:5px 5px 5px 5px; background:url(layouts/images/black_bg.png) repeat; color:#fff; font-size:10px; position:absolute; bottom:3px; left:3px; width:152px;}
            .black_bg2{ text-align:center; padding:5px 5px 5px 5px; background:url(layouts/images/black_bg.png) repeat; color:#fff; font-size:10px; position:absolute; top:3px; right:3px;}
            ul.pagein{ list-style:none; padding-left:0px; margin-left:0px; float:right; margin-right:25px;}
            ul.pagein li{ margin-left:0px; padding-left:0px; margin-right:2px; float:left;}
            ul.pagein li a{ display:block; background:url(layouts/images/bg_li.png) top left no-repeat; height:19px; width:25px; text-align:center; padding:4px 0px 2px 0px;}
            ul.pagein li a:hover{background:url(layouts/images/bg_li_over.png) top left no-repeat; text-decoration:none; color:#fff;}
            ul.pagein li a.curr_p{background:url(layouts/images/bg_li_over.png) top left no-repeat; text-decoration:none; color:#fff;}

            .top_light{ background:url(layouts/images/top_light.png) top left no-repeat; width:418px; height:9px;}
            .bot_light{ background:url(layouts/images/bottom_light.png) bottom left no-repeat; width:418px; height:9px;}
            .w418{ width:418px;}
            .mid_light{ background:url(layouts/images/mig_light.png) repeat;}
            .w402{ width:402px; background:#FFFFFF;}
            .w382{ width:382px;}
            .bg_top_light{ background:url(layouts/images/bg_top_light.png) top left repeat-x; height:43px;}
            .b1b{ border-bottom:1px solid #999999; padding-bottom:2px; margin-bottom:15px;}
            .white{ color:#fff;}
            .p10t{ padding-top:10px;}
            .p10b{ padding-bottom:10px;}
            h1{ font-size:18px; padding:0px; margin:0px;}
            .bg_img{ background:url(images/bg_small_img.png) top left no-repeat; width:65px; height:65px; text-align:center; padding-top:3px;}
            .bg_img img{ width:60px; overflow:hidden;}  
            .lightbox-normal-text-size{
                font-size: 11px;
            }
            .home_body{
                text-align: center;
                padding: 10px;                    
            }
            .bg_overlay {
                background: url("layouts/images/bg_overlay.png") repeat scroll left top transparent;
                color: #FFFFFF;
                font-size: 16px;
                left: 13px;
                padding: 15px;
                position: absolute;
                top: 1px;
                width: 705px;
            }
        </style>
        <script type="text/javascript" src="../libs/js/jquery.min.js"></script>
        <script type="text/javascript" src="../libs/js/jquery.blockUI.js"></script>
        <script type="text/javascript">
            jQuery.noConflict();
        </script>        

        <script type="text/javascript" src="assets/js/contest.js"></script>   

        <link type="text/css" rel="stylesheet" href="../libs/lightface/Assets/LightFace.css" />

        <script type="text/javascript" src="../libs/js/mootools-1.3.js"></script>

        <script type="text/javascript" src="../libs/lightface/tests/mootools-more-drag.js"></script>
        <script type="text/javascript" src="../libs/lightface/Source/LightFace.js"></script>
        <script type="text/javascript" src="../libs/lightface/Source/LightFace.Request.js"></script>
        <script type="text/javascript" src="../libs/lightface/Source/LightFace.Static.js"></script>
        <script type="text/javascript" src="../libs/lightface/Source/LightFace.IFrame.js"></script>
        <script type="text/javascript" src="../libs/lightface/Source/LightFace.Image.js"></script>

        <!-- start loading private library -->
        <script type="text/javascript" src="assets/js/facebooktab.js"></script>
    </head>
    <body>
        <script src="http://connect.facebook.net/en_US/all.js"></script>
        <div id="fb-root"></div>
        <script type="text/javascript" charset="utf-8">            
            FB.init({
                appId  : '<?php echo $view->config['facebook_app_id']; ?>',
//                status : true, // check login status
                cookie : true, // enable cookies to allow the server to access the session
                xfbml  : true, // parse XFBML
                //channelURL : 'http://ssl.socialmediatoolbox.no/coupon/calendar/channel.html', // channel.html file
                oauth  : true // enable OAuth 2.0
            });
            /*
            FB.UIServer.setLoadedNode = function (a, b){FB.UIServer._loadedNodes[a.id] = b; }                       
            
            FB.getLoginStatus(function(response) {
                if (response.authResponse) {
                    
                } else {

                }
            });
            
            function logintofacebook(){
                FB.login(function(response) {
                    if (response.authResponse) {
                        console.log('Welcome!  Fetching your information.... ');
                        FB.api('/me', function(response) {
                            console.log('Good to see you, ' + response.name + '.');
                            FB.logout(function(response) {
                                console.log('Logged out.');
                            });
                        });
                    } else {
                        console.log('User cancelled login or did not fully authorize.');
                    }
                }, {scope: 'email'});
            }
        
            <input type="button" onclick="logintofacebook()" value="login" />
            */
            
        </script>
        
        <!-- set up the javascript variables --> 
        <script type="text/javascript">
<?php if ($view->isConnectedFacebook) { ?>
                    contestapp.isConnectedFacebook = true;
<?php } ?>
    // set up for lightbox
            facebooktab.lightboxPaddingTop = 180;
            facebooktab.lightboxAutoAdjust = false;
            contestapp.tostitle = "<?php echo $view->contest['tos_link_text']; ?>";
        </script>
        <div class="w760 mc">
            <table cellpadding="0" cellspacing="0" width="760" align="center">
                
                <tr>
                    <td>
                        <div class="bg_top po">
                            <div class="bg_overlay">
                                    <p><?php echo $view->contest['overlay_text']; ?></p>
                            </div>
                            <img src="<?php echo $view->contest['banner_overlay_image'];?>" alt="" class="img_top"/>
                        </div>
                    </td>
                </tr> 
                
                <tr>
                    <td>
                        <ul class="menu">
                            <li><a href="?action=vote" <?php if($view->action == "vote"){?>class="curr"<?php } ?>>Bidrag</a></li>           
                            <?php if($this->contest['show_signup_tab'] == "on") { ?>
                            <li><a href="?action=index" <?php if($view->action == "index"){?>class="curr"<?php } ?>><?php echo $view->contest['signup_tab_lable']; ?></a></li>                                
                            <?php } ?>
                            <?php if($this->contest['show_about_tab'] == "on") { ?>
                            <li><a href="?action=about" <?php if($view->action == "about"){?>class="curr"<?php } ?>><?php echo $view->contest['tab_lable']; ?></a></li>                                
                            <?php } ?>
                        </ul>                        
                    </td>
                </tr>              
                
                <tr>
                    <td>
                        <?php echo $view->view_content; ?>
                    </td>
                </tr>
                <tr>
                    <td>
                        <div class="bg_bottom">
                            <table border="0">
                                <tr>
                                    <td style="vertical-align: middle; padding-left: 5px;">  
                                        <?php 
                                        
                                        $likeURL = $view->config['global_facebook_like_url'];
                                        
                                        ?>
                                        
                                        <iframe src="http://www.facebook.com/plugins/like.php?href=<?php echo urlencode($likeURL); ?>&amp;send=false&amp;layout=button_count&amp;width=90&amp;show_faces=false&amp;action=like&amp;colorscheme=light&amp;font&amp;height=21" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:90px; height:21px;" allowTransparency="true"></iframe>
                                    </td>
                                    <td style="vertical-align: middle;">
                                        <g:plusone size="medium" href="<?php echo $view->config['global_google_plus_url'];?>"></g:plusone>
                                    </td>
                                </tr>
                            </table>
                        </div>
                        <div style="float:right;padding: 10px;margin-top: -15px;font-size: 8pt;"><a href="javascript:contestapp.showTOSWindow();"><?php echo $view->contest['tos_link_text'];?></a></div>
                    </td>
                </tr>
            </table>

        </div>
        <script type="text/javascript" src="http://apis.google.com/js/plusone.js">
            {lang: 'no'}
        </script>     
        <script type="text/javascript">  
            
            document.id(document.body).addEvent('click',facebooktab.likecloser);
            <?php if(isset($_GET['enable'])) { ?>                
                function st_gup( name, obj ) {
                  name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
                  var regexS = "[\\?&]"+name+"=([^&#]*)";
                  var regex = new RegExp( regexS );
                  var results = regex.exec( obj );
                  if( results == null )
                    return "";
                  else
                    return results[1];
                }                
                if((st_gup("sta", parent.window.location.href) != st_gup("action", window.location.href)) && (st_gup("sta", parent.window.location.href) == "index")) {
                    var staction = st_gup("sta", parent.window.location.href);
                    var iframe = parent.document.getElementById('st_contest_iframe');                
                    var src = iframe.getAttribute('src');                
                    iframe.setAttribute('src', src + '&action=' + staction); 
                }
            <?php } ?>            
            
        </script>
        <br/>
        
    </body>
</html>
